/*
 * ========================================================
 * Copyright(c) 2014 杭州偶尔科技-版权所有
 * ========================================================
 * 本软件由杭州偶尔科技所有, 未经书面许可, 任何单位和个人不得以
 * 任何形式复制代码的部分或全部, 并以任何形式传播。
 * 公司网址
 * 
 * 			http://www.kkkd.com/
 * 
 * ========================================================
 */
package com.simon.mengkou.data.bean.req;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ouertech.android.agm.lib.base.bean.BaseRequest;
import com.ouertech.android.agm.lib.base.utils.UtilList;
import com.simon.mengkou.data.bean.base.Image;
import com.simon.mengkou.data.bean.base.ImageExt;
import com.simon.mengkou.data.bean.base.ImageTag;
import com.simon.mengkou.data.bean.base.Tag;

import java.util.List;

/**
 * @author : Zhenshui.Xia
 * @since : 2016/4/1.
 * desc    : 发布晒单请求参数
 */
public class ShareOrderAddReq extends BaseRequest {
    private static final long serialVersionUID = 1L;

    //用户id
    private String uid;
    //内容
    private String content;
    //图片key
    private List<Image> images;
    //标签列表
    private List<Tag> tags;
    //
    private List<ImageExt> imagesExt;

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
        add("uid", uid);
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
        add("content", content);
    }

    public List<Image> getImages() {
        return images;
    }

    public void setImages(List<Image> images) {
        this.images = images;
        int count = UtilList.getCount(images);
        for(int i=0; i<count; i++) {
            add("images[" + i +"]", images.get(i).getKey());
        }
    }

    public List<Tag> getTags() {
        return tags;
    }

    public void setTags(List<Tag> tags) {
        this.tags = tags;
        int count = UtilList.getCount(tags);
        for(int i=0; i<count; i++) {
            add("tags[" + i +"]", tags.get(i).getName());
        }
    }

    public List<ImageExt> getImagesExt() {
        return imagesExt;
    }

    public void setImagesExt(List<ImageExt> imagesExt) {
        this.imagesExt = imagesExt;
        int count = UtilList.getCount(imagesExt);
        for(int i=0; i<count; i++) {
            add("images[" + i +"]", imagesExt.get(i).getKey());
        }

        String str = new Gson().toJson(imagesExt, new TypeToken<List<ImageExt>>() {}.getType());
        add("imagesExt", str);
    }
}
